import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex)
const store=new Vuex.Store({
	state:{
		text:"这是共享的数据",
		timer: 0,
		list: [
			{
				id: '001',
				name: 'waouwoujds'
			},
			{
				id: '002',
				name: 'dfvgfbhgjhymn'
			},
			{
				id: '003',
				name: 'xsddccdd'
			},
			{
				id: '004',
				name: 'hahaha'
			},
		]
	},
	getters:{
		reverseText:function(state){
			return state.text+"这是计算属性之后的值"
		}
	},
	mutations:{
		cgtext(state,value){
			state.text=value;
		},
		changeTimer0: function(state, val){
			state.timer = state.timer + val
		}
	},
	actions:{
		changeTimer: function(context, val){
			context.commit('changeTimer0', val)
		}
	}
})
export default store
	

